package kz.pompei.ifacer.dialogs;

import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.RenderingHints;

public class FontUtil {
  public static Graphics2D prepare(Graphics g) {
    if (!(g instanceof Graphics2D)) throw new IllegalArgumentException("Graphics is not Graphics2D");
    Graphics2D g2 = (Graphics2D)g;
    g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
    g2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
        RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
    g2.setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS,
        RenderingHints.VALUE_FRACTIONALMETRICS_ON);
    return g2;
  }
}
